﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XT.Model;

namespace XT.Repository
{
    public class AccountRepository : Repository<Account, Int32>, IAccountRepository
    {
        public AccountRepository(DataContext context)
        {
            Context = context;
        }

        public Account checkExistEmail(string mail)
        {
            return ExecuteQuery(context => context.GetTable<Account>().SingleOrDefault(c => c.Account_Email.Equals(mail)));
        }
        public Account checkExistUsername(string username)
        {
            return ExecuteQuery(context => context.GetTable<Account>().SingleOrDefault(c => c.Account_Username.Equals(username)));
        }
        public Account searchName(string name)
        {
            return ExecuteQuery(context => context.GetTable<Account>().SingleOrDefault(c => c.Account_Name.Equals(name)));
        }
    }
}
